from python_baway.common.xcommon import sep


class Dog1:
    
    kind = 'Canine'
    tricks = []

    def __init__(self, name):
        self.name = name

    def add_trick(self, trick):
        self.tricks.append(trick)


class Dog2:
    kind = 'Canine'

    def __init__(self, name):
        self.name = name
        self.tricks = []

    def __del__(self):
        print('Destroying {} {}'.format(self.kind, self.name))

    def add_trick(self, trick):
        self.tricks.append(trick)


def test_dog_class(xclass):
    sep(label=repr(xclass))
    d = xclass('Fido')
    d.add_trick('Woof')
    e = xclass('Buddy')
    e.add_trick('Jump')
    f = xclass('Maomao')
    f.kind = '金毛'
    print('d.kind', d.kind)
    print('d.name', d.__name)
    print(d.tricks)
    print('e.kind', e.kind)
    print('e.name', e.__name)
    print(e.tricks)
    print('f.kind', f.kind)
    print('f.name', f.__name)
    print(f.tricks)
    


test_dog_class(Dog1)
test_dog_class(Dog2)
